package com.xkdx.caipiao.toggle;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;

public class SettingUtils {
	public static final String SEVEN_COLOR = "seven_color";
	public static final String LOTTO = "lotto";
	public static final String ARRAY_3 = "array_3";
	public static final String ARRAY_5 = "array_5";

	public static boolean get(Context context, String name, boolean defaultValue) {
		final SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		boolean value = prefs.getBoolean(name, defaultValue);
		return value;
	}

	public static boolean set(Context context, String name, boolean value) {
		final SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		Editor editor = prefs.edit();
		editor.putBoolean(name, value);
		return editor.commit();
	}
}
